package com.sky.controller.user;

import com.sky.dto.UserLoginDTO;
import com.sky.result.Result;
import com.sky.service.UserService;
import com.sky.vo.UserLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "用户相关接口")
@Slf4j
@RequestMapping("/user/user")
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 微信登录
     * @param dto
     * @return
     */
    @ApiOperation("微信登录")
    @PostMapping("/login")
    public Result login(@RequestBody UserLoginDTO dto){
        log.info("微信登录：code={}",dto);
        UserLoginVO vo = userService.login(dto);
        return Result.success(vo);
    }

    @GetMapping("/test")
    public Result test(){
        return Result.success();
    }

}
